import { reqAddressInfo, reqOrderInfo } from '@/api';


const actions = {
  // 获取用户地址信息
  async getUserAddress({ commit }) {
    let result = await reqAddressInfo()
    if (result.code == 200) {
      commit("GETUSERADDRESS", result.data)
    }
  },
  // 获取商品清单
  async getOrderInfo({ commit }) {
    let result = await reqOrderInfo()
    if (result.code == 200) {
      commit("GETORDERINFO", result.data)
    }
  },
}

const mutations = {
  // 获取用户地址信息
  GETUSERADDRESS(state, addressInfo) {
    state.addressInfo = addressInfo
  },
  // 获取商品清单
  GETORDERINFO(state, orderInfo) {
    state.orderInfo = orderInfo
  }
}

const getters = {
  // 商品数据简化
  orderDetailVoList() {

  }
}

const state = {
  addressInfo: [],
  orderInfo: {}
}

export default {
  state,
  actions,
  mutations,
  getters,
}
